{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "name": "bertQA-finetuning.ipynb",
      "provenance": [],
      "collapsed_sections": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/dcpengjin/DeepLearnToolbox/blob/master/bertQA_finetuning.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "2yaNMyKvXeDG"
      },
      "source": [
        "授权"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "5Be9KaakWIkD",
        "outputId": "b23b3b4d-5a53-4b38-80a7-99f5d6c05b9d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 229
        }
      },
      "source": [
        "!apt-get install -y -qq software-properties-common python-software-properties module-init-tools\n",
        "!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null\n",
        "!apt-get update -qq 2>&1 > /dev/null\n",
        "!apt-get -y install -qq google-drive-ocamlfuse fuse\n",
        "from google.colab import auth\n",
        "auth.authenticate_user()\n",
        "from oauth2client.client import GoogleCredentials\n",
        "creds = GoogleCredentials.get_application_default()\n",
        "import getpass\n",
        "!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL\n",
        "vcode = getpass.getpass()\n",
        "!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}"
      ],
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "E: Package 'python-software-properties' has no installation candidate\n",
            "Selecting previously unselected package google-drive-ocamlfuse.\n",
            "(Reading database ... 145653 files and directories currently installed.)\n",
            "Preparing to unpack .../google-drive-ocamlfuse_0.7.14-0ubuntu1~ubuntu18.04.1_amd64.deb ...\n",
            "Unpacking google-drive-ocamlfuse (0.7.14-0ubuntu1~ubuntu18.04.1) ...\n",
            "Setting up google-drive-ocamlfuse (0.7.14-0ubuntu1~ubuntu18.04.1) ...\n",
            "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n",
            "Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force\n",
            "··········\n",
            "Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force\n",
            "Please enter the verification code: Access token retrieved correctly.\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "C9ZsQndFXiA8"
      },
      "source": [
        "挂载Google drive"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "P_0gjL5oXRlB",
        "colab": {}
      },
      "source": [
        "!mkdir -p drive\n",
        "!google-drive-ocamlfuse drive"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "4guHcGqdXnO1"
      },
      "source": [
        "check\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "J47LDw6-Xq76",
        "outputId": "e17c77b5-6e93-40d5-ccb4-79bdef323d0c",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 314
        }
      },
      "source": [
        "#看看GPU显存\n",
        "!/opt/bin/nvidia-smi"
      ],
      "execution_count": 3,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Thu Dec 12 13:38:07 2019       \n",
            "+-----------------------------------------------------------------------------+\n",
            "| NVIDIA-SMI 418.67       Driver Version: 418.67       CUDA Version: 10.1     |\n",
            "|-------------------------------+----------------------+----------------------+\n",
            "| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n",
            "| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\n",
            "|===============================+======================+======================|\n",
            "|   0  Tesla P100-PCIE...  Off  | 00000000:00:04.0 Off |                    0 |\n",
            "| N/A   44C    P0    26W / 250W |      0MiB / 16280MiB |      0%      Default |\n",
            "+-------------------------------+----------------------+----------------------+\n",
            "                                                                               \n",
            "+-----------------------------------------------------------------------------+\n",
            "| Processes:                                                       GPU Memory |\n",
            "|  GPU       PID   Type   Process name                             Usage      |\n",
            "|=============================================================================|\n",
            "|  No running processes found                                                 |\n",
            "+-----------------------------------------------------------------------------+\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "PwKdZub_Y2yH"
      },
      "source": [
        "开始"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "zRuQyr7MKg3d",
        "outputId": "b25a43ca-caad-414a-d3b3-4ce15591e100",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 396
        }
      },
      "source": [
        "#!pip install tensorflow-gpu==1.13.1\n",
        "!pip install tensorflow-gpu\n",
        "import tensorflow as tf"
      ],
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Requirement already satisfied: tensorflow-gpu in /usr/local/lib/python3.6/dist-packages (1.13.1)\n",
            "Requirement already satisfied: absl-py>=0.1.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (0.8.1)\n",
            "Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.12.0)\n",
            "Requirement already satisfied: tensorflow-estimator<1.14.0rc0,>=1.13.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.13.0)\n",
            "Requirement already satisfied: keras-applications>=1.0.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.0.8)\n",
            "Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.1.0)\n",
            "Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.1.0)\n",
            "Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (0.33.6)\n",
            "Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (0.8.0)\n",
            "Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.15.0)\n",
            "Requirement already satisfied: tensorboard<1.14.0,>=1.13.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.13.1)\n",
            "Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (1.15.0)\n",
            "Requirement already satisfied: protobuf>=3.6.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (3.10.0)\n",
            "Requirement already satisfied: gast>=0.2.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu) (0.2.2)\n",
            "Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-estimator<1.14.0rc0,>=1.13.0->tensorflow-gpu) (3.0.5)\n",
            "Requirement already satisfied: h5py in /usr/local/lib/python3.6/dist-packages (from keras-applications>=1.0.6->tensorflow-gpu) (2.8.0)\n",
            "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow-gpu) (3.1.1)\n",
            "Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow-gpu) (0.16.0)\n",
            "Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from protobuf>=3.6.1->tensorflow-gpu) (42.0.2)\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "text/html": [
              "<p style=\"color: red;\">\n",
              "The default version of TensorFlow in Colab will soon switch to TensorFlow 2.x.<br>\n",
              "We recommend you <a href=\"https://www.tensorflow.org/guide/migrate\" target=\"_blank\">upgrade</a> now \n",
              "or ensure your notebook will continue to use TensorFlow 1.x via the <code>%tensorflow_version 1.x</code> magic:\n",
              "<a href=\"https://colab.research.google.com/notebooks/tensorflow_version.ipynb\" target=\"_blank\">more info</a>.</p>\n"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {
            "tags": []
          }
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "CwRlenE8IKwl",
        "outputId": "c496ecf6-11d4-4d6f-a1e1-594beec8a026",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 559
        }
      },
      "source": [
        "#检查gpu可用\n",
        "from tensorflow.python.client import device_lib\n",
        "print(device_lib.list_local_devices())"
      ],
      "execution_count": 3,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[name: \"/device:CPU:0\"\n",
            "device_type: \"CPU\"\n",
            "memory_limit: 268435456\n",
            "locality {\n",
            "}\n",
            "incarnation: 15170532763005456631\n",
            ", name: \"/device:XLA_GPU:0\"\n",
            "device_type: \"XLA_GPU\"\n",
            "memory_limit: 17179869184\n",
            "locality {\n",
            "}\n",
            "incarnation: 1829147043633735990\n",
            "physical_device_desc: \"device: XLA_GPU device\"\n",
            ", name: \"/device:XLA_CPU:0\"\n",
            "device_type: \"XLA_CPU\"\n",
            "memory_limit: 17179869184\n",
            "locality {\n",
            "}\n",
            "incarnation: 6239547954547951711\n",
            "physical_device_desc: \"device: XLA_CPU device\"\n",
            ", name: \"/device:GPU:0\"\n",
            "device_type: \"GPU\"\n",
            "memory_limit: 15956161332\n",
            "locality {\n",
            "  bus_id: 1\n",
            "  links {\n",
            "  }\n",
            "}\n",
            "incarnation: 4834456796333323697\n",
            "physical_device_desc: \"device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:00:04.0, compute capability: 6.0\"\n",
            "]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "YlVOLEJqbWg5",
        "outputId": "0dd1615d-d712-46a9-b27a-df25fd854885",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 174
        }
      },
      "source": [
        "!pip3 uninstall numpy\n",
        "!pip3 install numpy==1.15.0"
      ],
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Uninstalling numpy-1.15.0:\n",
            "  Would remove:\n",
            "    /usr/local/bin/conv-template\n",
            "    /usr/local/bin/f2py\n",
            "    /usr/local/bin/from-template\n",
            "    /usr/local/lib/python3.6/dist-packages/numpy-1.15.0.dist-info/*\n",
            "    /usr/local/lib/python3.6/dist-packages/numpy/*\n",
            "Proceed (y/n)? n\n",
            "Requirement already satisfied: numpy==1.15.0 in /usr/local/lib/python3.6/dist-packages (1.15.0)\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "SDqOwutqZITo",
        "outputId": "e3ed11c2-4b26-4168-baa6-db7c5984d65c",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 262
        }
      },
      "source": [
        "#将工作路径设置到这个文件夹\n",
        "import os\n",
        "path = \"/content/drive/Colab Notebooks/bertQA（含数据集和bert）/bert\"\n",
        "os.chdir(path)\n",
        "os.listdir(path)\n",
        "!ls"
      ],
      "execution_count": 18,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "chinese_L-12_H-768_A-12     optimization_test.py\n",
            "CONTRIBUTING.md\t\t    predicting_movie_reviews_with_bert_on_tf_hub.ipynb\n",
            "create_pretraining_data.py  __pycache__\n",
            "data\t\t\t    README.md\n",
            "extract_features.py\t    requirements.txt\n",
            "__init__.py\t\t    run_classifier.py\n",
            "LICENSE\t\t\t    run_classifier_with_tfhub.py\n",
            "modeling.py\t\t    run_my.py\n",
            "modeling_test.py\t    run_pretraining.py\n",
            "muji.py\t\t\t    run_squad.py\n",
            "multilingual.md\t\t    sample_text.txt\n",
            "nerdata\t\t\t    tf_metrics.py\n",
            "new.py\t\t\t    tokenization.py\n",
            "optimization.py\t\t    tokenization_test.py\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "ttCmfdfzRphy",
        "outputId": "230b3322-64f1-46ce-fbc5-7aa663a19aef",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "!ls"
      ],
      "execution_count": 15,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "bert  bertQA-finetuning.ipynb\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "DrjR8RgklB5F",
        "outputId": "46c3cb2a-494a-4e3e-fdf1-1f9c85f701f4",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "!python run_my.py \\\n",
        "  --task_name=mybert \\\n",
        "  --do_train=true \\\n",
        "  --do_eval=true \\\n",
        "  --data_dir=data \\\n",
        "  --vocab_file=chinese_L-12_H-768_A-12/vocab.txt \\\n",
        "  --bert_config_file=chinese_L-12_H-768_A-12/bert_config.json \\\n",
        "  --init_checkpoint=chinese_L-12_H-768_A-12/bert_model.ckpt \\\n",
        "  --max_seq_length=128 \\\n",
        "  --train_batch_size=32 \\\n",
        "  --learning_rate=2e-5 \\\n",
        "  --num_train_epochs=3.0 \\\n",
        "  --output_dir=output \\"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "\n",
            "WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.\n",
            "For more information, please see:\n",
            "  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md\n",
            "  * https://github.com/tensorflow/addons\n",
            "If you depend on functionality not listed there, please file an issue.\n",
            "\n",
            "你好，你哪儿不舒服\n",
            "你好\n",
            "WARNING:tensorflow:Estimator's model_fn (<function model_fn_builder.<locals>.model_fn at 0x7f89f10b1ea0>) includes params argument, but params are not passed to Estimator.\n",
            "INFO:tensorflow:Using config: {'_model_dir': 'output', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': 1000, '_save_checkpoints_secs': None, '_session_config': allow_soft_placement: true\n",
            "graph_options {\n",
            "  rewrite_options {\n",
            "    meta_optimizer_iterations: ONE\n",
            "  }\n",
            "}\n",
            ", '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': None, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_service': None, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7f893f85ba58>, '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1, '_tpu_config': TPUConfig(iterations_per_loop=1000, num_shards=8, num_cores_per_replica=None, per_host_input_for_training=3, tpu_job_name=None, initial_infeed_sleep_secs=None, input_partition_dims=None), '_cluster': None}\n",
            "INFO:tensorflow:_TPUContext: eval_on_tpu True\n",
            "WARNING:tensorflow:eval_on_tpu ignored because use_tpu is False.\n",
            "INFO:tensorflow:Writing example 0 of 9999998\n",
            "INFO:tensorflow:*** Example ***\n",
            "INFO:tensorflow:guid: train-0-1\n",
            "INFO:tensorflow:tokens: [CLS] 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 ？ 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 是 越 少 越 好 。 无 麻 烦 解 答 ， 谢 谢 。 [SEP] b 超 属 于 超 声 波 经 常 检 查 是 不 好 的 而 且 也 没 有 必 要 经 常 检 查 的 一 般 怀 孕 两 个 月 检 查 一 下 怀 孕 五 个 月 检 查 一 下 快 出 生 时 在 检 查 就 可 以 还 有 就 是 不 舒 服 检 查 就 可 以 [SEP]\n",
            "INFO:tensorflow:input_ids: 101 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 8043 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 3221 6632 2208 6632 1962 511 3187 7937 4172 6237 5031 8024 6468 6468 511 102 144 6631 2247 754 6631 1898 3797 5307 2382 3466 3389 3221 679 1962 4638 5445 684 738 3766 3300 2553 6206 5307 2382 3466 3389 4638 671 5663 2577 2097 697 702 3299 3466 3389 671 678 2577 2097 758 702 3299 3466 3389 671 678 2571 1139 4495 3198 1762 3466 3389 2218 1377 809 6820 3300 2218 3221 679 5653 3302 3466 3389 2218 1377 809 102\n",
            "INFO:tensorflow:input_mask: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:segment_ids: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:label: 1 (id = 1)\n",
            "INFO:tensorflow:*** Example ***\n",
            "INFO:tensorflow:guid: train-0-0\n",
            "INFO:tensorflow:tokens: [CLS] 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 ？ 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 是 越 少 越 好 。 无 麻 烦 解 答 ， 谢 谢 。 [SEP] 碘 131 是 一 种 具 有 一 定 放 射 性 的 药 物 ， 可 以 直 接 杀 死 一 些 甲 状 腺 细 胞 ， 使 甲 状 腺 功 能 降 低 碘 131 服 用 不 当 就 会 造 成 甲 减 ， 而 突 眼 症 是 甲 亢 引 发 的 ， 可 以 通 过 手 术 进 [SEP]\n",
            "INFO:tensorflow:input_ids: 101 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 8043 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 3221 6632 2208 6632 1962 511 3187 7937 4172 6237 5031 8024 6468 6468 511 102 4814 9403 3221 671 4905 1072 3300 671 2137 3123 2198 2595 4638 5790 4289 8024 1377 809 4684 2970 3324 3647 671 763 4508 4307 5593 5301 5528 8024 886 4508 4307 5593 1216 5543 7360 856 4814 9403 3302 4500 679 2496 2218 833 6863 2768 4508 1121 8024 5445 4960 4706 4568 3221 4508 768 2471 1355 4638 8024 1377 809 6858 6814 2797 3318 6822 102\n",
            "INFO:tensorflow:input_mask: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:segment_ids: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:label: 0 (id = 0)\n",
            "INFO:tensorflow:*** Example ***\n",
            "INFO:tensorflow:guid: train-1-1\n",
            "INFO:tensorflow:tokens: [CLS] 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 ？ 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 是 越 少 越 好 。 无 麻 烦 解 答 ， 谢 谢 。 [SEP] b 超 属 于 超 声 波 经 常 检 查 是 不 好 的 而 且 也 没 有 必 要 经 常 检 查 的 一 般 怀 孕 两 个 月 检 查 一 下 怀 孕 五 个 月 检 查 一 下 快 出 生 时 在 检 查 就 可 以 还 有 就 是 不 舒 服 检 查 就 可 以 [SEP]\n",
            "INFO:tensorflow:input_ids: 101 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 8043 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 3221 6632 2208 6632 1962 511 3187 7937 4172 6237 5031 8024 6468 6468 511 102 144 6631 2247 754 6631 1898 3797 5307 2382 3466 3389 3221 679 1962 4638 5445 684 738 3766 3300 2553 6206 5307 2382 3466 3389 4638 671 5663 2577 2097 697 702 3299 3466 3389 671 678 2577 2097 758 702 3299 3466 3389 671 678 2571 1139 4495 3198 1762 3466 3389 2218 1377 809 6820 3300 2218 3221 679 5653 3302 3466 3389 2218 1377 809 102\n",
            "INFO:tensorflow:input_mask: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:segment_ids: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:label: 1 (id = 1)\n",
            "INFO:tensorflow:*** Example ***\n",
            "INFO:tensorflow:guid: train-1-0\n",
            "INFO:tensorflow:tokens: [CLS] 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 ？ 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 是 越 少 越 好 。 无 麻 烦 解 答 ， 谢 谢 。 [SEP] 胸 部 下 垂 了 ， 轻 度 的 可 以 通 过 丰 胸 矫 正 。 脸 上 雀 斑 明 显 可 以 做 激 光 治 疗 。 谢 谢 留 言 。 [SEP]\n",
            "INFO:tensorflow:input_ids: 101 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 8043 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 3221 6632 2208 6632 1962 511 3187 7937 4172 6237 5031 8024 6468 6468 511 102 5541 6956 678 1795 749 8024 6768 2428 4638 1377 809 6858 6814 705 5541 4763 3633 511 5567 677 7411 3157 3209 3227 1377 809 976 4080 1045 3780 4545 511 6468 6468 4522 6241 511 102 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
            "INFO:tensorflow:input_mask: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
            "INFO:tensorflow:segment_ids: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
            "INFO:tensorflow:label: 0 (id = 0)\n",
            "INFO:tensorflow:*** Example ***\n",
            "INFO:tensorflow:guid: train-2-1\n",
            "INFO:tensorflow:tokens: [CLS] 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 ？ 不 是 说 做 b 超 对 宝 宝 不 好 吗 ？ 那 怀 孕 检 查 是 不 是 越 少 越 好 。 无 麻 烦 解 答 ， 谢 谢 。 [SEP] b 超 属 于 超 声 波 经 常 检 查 是 不 好 的 而 且 也 没 有 必 要 经 常 检 查 的 一 般 怀 孕 两 个 月 检 查 一 下 怀 孕 五 个 月 检 查 一 下 快 出 生 时 在 检 查 就 可 以 还 有 就 是 不 舒 服 检 查 就 可 以 [SEP]\n",
            "INFO:tensorflow:input_ids: 101 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 8043 679 3221 6432 976 144 6631 2190 2140 2140 679 1962 1408 8043 6929 2577 2097 3466 3389 3221 679 3221 6632 2208 6632 1962 511 3187 7937 4172 6237 5031 8024 6468 6468 511 102 144 6631 2247 754 6631 1898 3797 5307 2382 3466 3389 3221 679 1962 4638 5445 684 738 3766 3300 2553 6206 5307 2382 3466 3389 4638 671 5663 2577 2097 697 702 3299 3466 3389 671 678 2577 2097 758 702 3299 3466 3389 671 678 2571 1139 4495 3198 1762 3466 3389 2218 1377 809 6820 3300 2218 3221 679 5653 3302 3466 3389 2218 1377 809 102\n",
            "INFO:tensorflow:input_mask: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:segment_ids: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
            "INFO:tensorflow:label: 1 (id = 1)\n",
            "INFO:tensorflow:Writing example 10000 of 9999998\n",
            "INFO:tensorflow:Writing example 20000 of 9999998\n",
            "我肚子疼，头疼，应该怎么办？\n",
            "可以吗？\n",
            "INFO:tensorflow:Writing example 30000 of 9999998\n",
            "INFO:tensorflow:Writing example 40000 of 9999998\n",
            "INFO:tensorflow:Writing example 50000 of 9999998\n",
            "INFO:tensorflow:Writing example 60000 of 9999998\n",
            "INFO:tensorflow:Writing example 70000 of 9999998\n",
            "INFO:tensorflow:Writing example 80000 of 9999998\n",
            "INFO:tensorflow:Writing example 90000 of 9999998\n",
            "INFO:tensorflow:Writing example 100000 of 9999998\n",
            "INFO:tensorflow:Writing example 110000 of 9999998\n",
            "INFO:tensorflow:Writing example 120000 of 9999998\n",
            "INFO:tensorflow:Writing example 130000 of 9999998\n",
            "INFO:tensorflow:Writing example 140000 of 9999998\n",
            "INFO:tensorflow:Writing example 150000 of 9999998\n",
            "INFO:tensorflow:Writing example 160000 of 9999998\n",
            "INFO:tensorflow:Writing example 170000 of 9999998\n",
            "INFO:tensorflow:Writing example 180000 of 9999998\n",
            "INFO:tensorflow:Writing example 190000 of 9999998\n",
            "INFO:tensorflow:Writing example 200000 of 9999998\n",
            "INFO:tensorflow:Writing example 210000 of 9999998\n",
            "INFO:tensorflow:Writing example 220000 of 9999998\n",
            "INFO:tensorflow:Writing example 230000 of 9999998\n",
            "INFO:tensorflow:Writing example 240000 of 9999998\n",
            "INFO:tensorflow:Writing example 250000 of 9999998\n",
            "INFO:tensorflow:Writing example 260000 of 9999998\n",
            "INFO:tensorflow:Writing example 270000 of 9999998\n",
            "INFO:tensorflow:Writing example 280000 of 9999998\n",
            "INFO:tensorflow:Writing example 290000 of 9999998\n",
            "INFO:tensorflow:Writing example 300000 of 9999998\n",
            "INFO:tensorflow:Writing example 310000 of 9999998\n",
            "INFO:tensorflow:Writing example 320000 of 9999998\n",
            "INFO:tensorflow:Writing example 330000 of 9999998\n",
            "INFO:tensorflow:Writing example 340000 of 9999998\n",
            "INFO:tensorflow:Writing example 350000 of 9999998\n",
            "INFO:tensorflow:Writing example 360000 of 9999998\n",
            "INFO:tensorflow:Writing example 370000 of 9999998\n",
            "INFO:tensorflow:Writing example 380000 of 9999998\n"
          ],
          "name": "stdout"
        }
      ]
    }
  ]
}